<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h = "http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </h:head>
    <!-- Adds a product to the database -->
    <h:body>
        <ui:composition template="/WEB-INF/facelets/template.xhtml">
            <ui:param name="title" value="Add Product - Chalmers Food Store" />
            <ui:define name="content">
                <h:form id="addProductForm">
                    <br/>
                    <h1>Add product:</h1>
                    <hr/>
                    <h:panelGrid columns="2" >
                        <h:outputLabel value="Name: "/>
                        <p:inputText value="#{addProductBackingBean.name}" />
                        <h:outputLabel value="Category: "/>
                        <p:inputText value="#{addProductBackingBean.category}" />
                        <h:outputLabel value="Description: "/>
                        <p:inputTextarea value="#{addProductBackingBean.description}" cols="20" rows="1" />
                        <h:outputLabel value="Price: "/>
                        <p:inputText value="#{addProductBackingBean.price}" />
                    </h:panelGrid>
                    <br/>
                    <p:commandButton value="Add Product" action="/admin/admin.xhtml?faces-redirect=true" actionListener="#{productControllerBean.addProduct()}" />
                    &nbsp;
                    <p:button value="Cancel" outcome="goToAdmin" />
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
